package com.qf.ticketredis;

public class MainApp {

    public static void main(String[] args) throws InterruptedException {
        MainApp mainApp = new MainApp();

        new Thread(()->{
            try {
                mainApp.a();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();

       Thread.sleep(500);

        new Thread(()->{
            mainApp.b();
        }).start();
    }


    public synchronized void a() throws InterruptedException { //this
        System.out.println("---a---" + Thread.currentThread().getName());

        Thread.sleep(5000);

        b();
    }

    public synchronized void b(){ //this
        System.out.println("---b---"+ Thread.currentThread().getName());
    }
}
